package omp.syst.eng;

public class Pixel {
	
	private int p;
	
	public Pixel(){};
	
	public Pixel( int p ){
		this.p = p;
	}
	
	public void setPixel( int p ){
		this.p = p;
	}
	
	public int getPixel(){
		return this.p;
	}
	
	public void setRed( int v ){
		
		p = p & 0xff00ffff;
		
		v = v << 16;
		p = p | v;

	}

	public void setGreen( int v ){
		
		p = p & 0xffff00ff;

		v = v << 8;
		p = p | v;
	}

	public void setBlue( int v ){
		
		p = p & 0xffffff00;
		
		p = p | v;
	}

	public int getRed(){

		return ( ( p >> 16) & 0xff );
	}

	public int getGreen(){
		return ( ( p >> 8) & 0xff );
	}

	public int getBlue(){
		return( ( p ) & 0xff );
	}
	
	public void setGrayScale(){
		
		int gsl = ( getRed() + getGreen() + getBlue() ) / 3;
		
		setRed( gsl );
		setGreen( gsl );
		setBlue( gsl );
		
	}
}
